<template>
	<view class="feedback">
		<u--form labelPosition="left">
			<u-form-item>
				<u--textarea v-model="content" placeholder="请输入您的富贵意见"></u--textarea>
			</u-form-item>
		</u--form>

		<view class="flex flex-direction padding margin-top">
			<button :disabled="disabled" class="cu-btn bg-theme lg " @tap="submit()">提交</button>
		</view>

	</view>
</template>

<script>
	import feedbackModel from '@/models/FeedbackModel.js'

	export default {
		data() {
			return {
				content: '',
				disabled: false,
			}
		},
		onLoad(options) {},
		methods: {
			submit() {
				if (!this.content) {
					this.$base.alert('请输入内容');
					return false;
				}

				this.disabled = true;
				feedbackModel.add({
					content: this.content
				}).then(res => {
					uni.hideLoading();
					if (res.code == 200) {
						uni.showToast({
							title: res.msg,
							success() {
								setTimeout(() => {
									uni.navigateBack();
								}, 500);
							}
						})
					} else {
						this.disabled = false;
						this.$base.alert(res.msg);
					}

				})
			}
		}
	}
</script>

<style scoped lang="less">
	.feedback {
		padding: 20rpx;

		.cu-btn {
			width: 100%;
			color: #fff;
		}
	}
</style>